import os
import unittest
import time
from Common.handle_data import clear_EnvData_attrs, EnvData
from Common.handle_excel import HandleExcel
from Common.handle_path import datas_dir
from unittestreport import ddt, list_data
from TestCases_Business.jsonpash import Grt_Client_List

# 加载测试数据
he = HandleExcel(os.path.join(datas_dir, "api_test_data.xlsx"), "NoBranchText")
cases = he.read_all_datas()
he.close_file()  # 关闭文件


# @ddt
# class TestRecharge(unittest.TestCase):
#
#
#     @classmethod
#     def setUpClass(cls) -> None:
#         pass
#
#     def setUp(self) -> None:
#         clear_EnvData_attrs()
#     @list_data(cases)
#     def test_recharge(self,cases):
#         exam_no = cases['e_id']  #项目编号
#         e_dbname = 'exam_{}'.format(exam_no)  #数据库编号
#
#         setattr(EnvData,"exam_no",exam_no)
#         setattr(EnvData,"e_dbname",e_dbname)
#
#         Grt_Client_List()
@ddt
class AAA(unittest.TestCase):
    @list_data(cases)
    def test_damo(self,case):
        exam_no = case['id']  # 项目编号
        time.sleep(2)
        print(exam_no)


if __name__ == '__main__':
    unittest.main()

